<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form>
    账户名：<input type="text" id="account"><br/>
    密码：<input type="text" id="password"><br/>
    类型：<select id="typeId">
            <option value=1>普通用户</option>
            <option value=2>超级管理员</option>
         </select><br/>
    姓名：<input type="text" id="name"><br/>
    邮箱：<input type="text" id="email"><br/>
    状态：<input type="text" id="condition"><br/>
    <input type="button" id="zhuce" value="注册">
</form>
</body>
<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript">
    $("#zhuce").click(function () {
        ZhuCe();
    })
    function ZhuCe (){
        var account = $('#account').val();
        var password = $('#password').val();
        var typeId = parseInt($('#typeId').val());
        var name = $('#name').val();
        var email = $('#email').val();
        var condition = $('#condition').val();
        $.ajax({
            "url":"/T309tgspringboot/user/registerUser",
            "type":"post",
            "data":{
                "account":account,
                "password":password,
                "typeId":typeId,
                "name":name,
                "email":email,
                "condition":condition
            },
            "dataType":"json",
            "success":function(a){
                var r = parseInt(a.result["num"]);
                if(r>0){
                    window.location.href="/T309tgspringboot/login";
                }else{
                    alert("登录失败");
                    window.location.href="/T309tgspringboot/registerUser";
                }
            },
            "error":function(){
                alert("服务器错误");
            }
        });
    }
</script>
</html>